package com.aaa.proxy;

import com.aaa.proxy.impl.DynamicProxyImplCglib;
import com.aaa.proxy.impl.DynamicProxyImplJdk;

/**
 * @author ：Teacher陈（86521760@qq.com）
 * @date ：Created in 2022/8/18 12:09
 * @description：
 * @modified By：
 * @version:
 */
public class ProxyTest {
    public static void main(String[] args) {
       //获取代理对象
/*        MyJdkDynamic myJdkDynamic = new MyJdkDynamic();
        PhoneServiceImpl phoneService = new PhoneServiceImpl();
        PhoneService proxy = (PhoneService) myJdkDynamic.getProxy(phoneService);
        proxy.buyPhone(300);*/
/*        DynamicProxy myCglibDynamic = new MyCglibDynamic();
        PhoneServiceImpl phoneService = new PhoneServiceImpl();
        PhoneServiceImpl  proxy =  (PhoneServiceImpl)myCglibDynamic.getProxy(phoneService);
        proxy.buyPhone(300);*/
      /*  PhoneServiceImpl phoneService = new PhoneServiceImpl();
        DynamicProxyImplCglib<PhoneServiceImpl> dynamicProxyImplCglib= new DynamicProxyImplCglib();
        PhoneServiceImpl proxy = dynamicProxyImplCglib.getProxy(phoneService);
        proxy.buyPhone(3000);*/
        /* //获取目标对象
        ComputerService computerService = new ComputerServiceImpl();
        //获取代理对象
        MyJdkDynomic myJdkDynomic = new MyJdkDynomic();
        ComputerService proxy = (ComputerService) myJdkDynomic.getProxy(computerService);
        //使用代理对象执行
        proxy.salePC(30000);*/
        //实例化目标对象
       /* ComputerService computerService = new ComputerServiceImpl();
        //获取代理对象
        DynamicProxyImplJdk<ComputerService> dynamicProxyImplJdk= new DynamicProxyImplJdk<ComputerService>();
        ComputerService proxy = dynamicProxyImplJdk.getProxy(computerService);
        proxy.salePC(3000);*/

    }
}
